declare const wx: any;

export class Utils {
  public static getScoreInfo(): Promise {
    return new Promise(resolve => {
      wx.getFriendCloudStorage({
        keyList: ['score'], // 你要获取的、托管在微信后台都key
        success: res => {
          const data = res.data;
          data.sort((a, b) => {
            return parseInt(a.KVDataList[0].value) - parseInt(b.KVDataList[0].value);
          });
          resolve(data);
        }
      })
    })
  }

  public static getMyMax(): Promise {
    return new Promise(resolve => {
      wx.getUserCloudStorage({
        keyList: ['score'],
        success: res => {
          resolve(res.KVDataList[0].value)
        }
      })
    })
  }
}